Skip to content

Split target_os = "nto" cfg by env so io-sock variants use TCP_KEEPIDLE#654

Merged
Thomasdezeeuw merged 3 commits intorust-lang:masterfrom
skarlsson:qnx8-nto80-iosock
May 5, 2026
Merged

Split target_os = "nto" cfg by env so io-sock variants use TCP_KEEPIDLE#654
Thomasdezeeuw merged 3 commits intorust-lang:masterfrom
skarlsson:qnx8-nto80-iosock

Conversation

@skarlsson
Copy link
Copy Markdown
Contributor

QNX 8.0 (target_env = "nto80") ships only the io-sock network stack, which dropped TCP_KEEPALIVE in favour of the BSD-style TCP_KEEPIDLE. The same applies to QNX 7.1 with the optional io-sock stack (target_env = "nto71_iosock"). Only the legacy io-pkt envs (nto70, nto71) still expose TCP_KEEPALIVE.

Restricting the existing target_os = "nto" arms in the two KEEPALIVE_TIME aliases to the io-pkt envs lets io-sock variants fall through to the BSD-style TCP_KEEPIDLE arm that already exists. Requires the matching libc change (rust-lang/libc#5071) to land for the new constants to be visible.

QNX 8.0 (target_env = "nto80") ships only the io-sock network stack,
which dropped TCP_KEEPALIVE in favour of the BSD-style TCP_KEEPIDLE.
The same applies to QNX 7.1 with the optional io-sock stack
(target_env = "nto71_iosock"). Only the legacy io-pkt envs (nto70,
nto71) still expose TCP_KEEPALIVE.

Restricting the existing target_os = "nto" arms in the two
KEEPALIVE_TIME aliases to the io-pkt envs lets io-sock variants fall
through to the BSD-style TCP_KEEPIDLE arm that already exists.
Requires the matching libc change (rust-lang/libc#5071) to land for
the new constants to be visible.
Comment thread src/sys/unix.rs Outdated
Comment on lines +301 to +303
// QNX legacy io-pkt stack (nto70, nto71) exposes TCP_KEEPALIVE.
// The newer io-sock stack (nto71_iosock, nto80) replaced it with the
// BSD-style TCP_KEEPIDLE — handle both branches below.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a great place for this comment. Either move it below or just remove it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just remove it.

Comment thread src/sys/unix.rs
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add the new QNX versions to CI so we actually build this stuff?

target:
- aarch64-apple-darwin
- aarch64-apple-ios
- aarch64-apple-tvos
- aarch64-apple-visionos
- aarch64-apple-watchos
- aarch64-linux-android
- aarch64-unknown-freebsd
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- aarch64-unknown-linux-ohos
- aarch64-unknown-netbsd
- aarch64-unknown-openbsd
- aarch64-unknown-redox
- arm-linux-androideabi
- arm64_32-apple-watchos
- armv7-linux-androideabi
- armv7-sony-vita-newlibeabihf
- armv7-unknown-linux-ohos
- i686-linux-android
# Broken, see https://github.com/rust-lang/socket2/issues/539.
#- i686-unknown-hurd-gnu
- i686-unknown-linux-gnu
- sparcv9-sun-solaris
- x86_64-apple-darwin
- x86_64-apple-ios
- x86_64-pc-cygwin
- x86_64-pc-solaris
# Fails with:
# `rror calling dlltool 'x86_64-w64-mingw32-dlltool': No such file or
# directory (os error 2)`, build log:
# <https://github.com/rust-lang/socket2/actions/runs/9577808331/job/26406752150>.
#- x86_64-pc-windows-gnu
- x86_64-pc-windows-msvc
- x86_64-unknown-dragonfly
- x86_64-unknown-freebsd
- x86_64-unknown-fuchsia
- x86_64-unknown-illumos
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- x86_64-unknown-linux-ohos
- x86_64-unknown-netbsd
- x86_64-unknown-openbsd
- x86_64-unknown-redox
- wasm32-wasip2

Copy link
Copy Markdown
Collaborator

@Thomasdezeeuw Thomasdezeeuw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skarlsson if you can fix the rustfmt issue, this LGTM.

Comment thread src/sys/unix.rs Outdated
Comment on lines +301 to +303
// QNX legacy io-pkt stack (nto70, nto71) exposes TCP_KEEPALIVE.
// The newer io-sock stack (nto71_iosock, nto80) replaced it with the
// BSD-style TCP_KEEPIDLE — handle both branches below.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just remove it.

skarlsson and others added 2 commits May 4, 2026 20:29
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Thomasdezeeuw Thomasdezeeuw merged commit c93d95a into rust-lang:master May 5, 2026
53 checks passed
@Thomasdezeeuw
Copy link
Copy Markdown
Collaborator

Thanks @skarlsson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants